<?php if($this->errMsg) :?>
	<?php $this->showError($this->errMsg)?>
<?php endif; ?>
<?php if($this->msg) :?>		
	<?php $this->showMessage($this->msg)?>	
<?php endif;?>
<form name='form' id='form' action="" method="POST">
	<div class="title_ad"><label><a href="">Câu hỏi khảo sát mới</a></label>
	</div>
	<div class="mydiv">
	<table  class="tb_box">
		<tr>
			<td>
				<label>Mã Câu hỏi</label>
			</td>
			<td>
				<input readonly="readonly" type="text" name ="id" value = "">
			</td>
			<td>
				<label>Ngày Tạo</label>
			</td>
			<td>
				<input readonly="readonly" type="text" name ="qdate" value = "<?php echo $this->date?>">
			</td>
		</tr>
		<tr>
			<td>
				<label>Nội Dung câu hỏi</label>
			</td>
			<td>
				<TEXTAREA Name='qtitle' rows="3" cols="0" style="width: 250px;text-align: left;"></TEXTAREA> 
			</td>
			<td colspan="2">
				
			</td>
		</tr>
	</table>
		<div class="div_button" >	
			<input type="submit" value="Lưu" class="button"/>
			<input type="reset" value="Làm lại" class="button" />
		</div>
	</div>
</form>
<script>
function del(key)
{
	if(!confirm("Bạn muốn gỡ câu hỏi khỏi tin này không?"))
		return false;
	$("#news"+key).remove();
}
function addnews()
{
	$.ajax({
		type: "POST",
		url:"<?php echo $this->baseUrl.'/admin/news/listnews'?> ",
		dataType: 'json',
		success: function(msg){
			if(msg)
			{
				var count = $('select').length;
				var select = "";
				select += "<div id='news"+count+"'>";
				select += '<select name="news_id[]">';
				select +="<option>Chọn tin</option>";
				$.each(msg, function(key, value) { 
					select +="<option value='"+value['id']+"'>"+value['headLines']+"</option>"; 
				});
				select += "</select>&nbsp<a href='javascript:del("+count+")' title='Delete' class='tool-16 delete'></a>";
				select += "<br/>";
				select += "</div>";
				$('#arrnews').append(select);
			}else
				alert('Error');
		}
	});
}
</script>